//part1:C06:ex6.27.cpp
// sum of initializer_list<int>.
#include <iostream>


int iSum(const std::initializer_list<int> il) {
    int isum = 0;
    for (auto t : il) {
       isum += t; 
    }
    return isum;
}

int main(void) {
    using namespace std;
    cout << "{1, 6, 9}  sum is : " << iSum({1, 6, 9}) << endl;
    cout << "{4, 5, 9, 18} sum is : " << iSum({4, 5, 9, 18}) << endl;
    cout << "{10, 10, 10, 10, 10} sum is : " << iSum({10, 10, 10, 10, 10}) << endl;

    return 0;
}
